﻿
namespace OP10.ViewModels
{
    public class ST04ElectrodeNeedleConfigViewModel : BindableBase
    {

        private readonly IRegionManager _regionManager;

        public ST04ElectrodeNeedleConfigViewModel(IRegionManager regionManager)
        {
            _regionManager = regionManager;

            InitParam();
        }

        private void InitParam()
        {
            WireDia = WireParam_Global.WireDia;
            WireLen_Set = WireParam_Global.WireLen_Set;
            YLeftBuChang = WireParam_Global.YL偏心距补偿;
            YRightBuChang = WireParam_Global.YR偏心距补偿;
            XAxisBuChang = WireParam_Global.X轴补偿;
            QiaosiHeight = WireParam_Global.桥丝距产品高度;
            TensionLimitH = WireParam_Global.TensionLimit_UP;
            TensionLimitL = WireParam_Global.TensionLimit_Down;
            TurretDia = WireParam_Global.TurretDia;
            FeedDia = WireParam_Global.FeedDia;
            XAxisDown = WireParam_Global.X_ServoLimitMinus;
            XAxisUp = WireParam_Global.X_ServoLimitPlus;
            YLAxisDown = WireParam_Global.YL_ServoLimitMinus;
            YLAxisUp = WireParam_Global.YR_ServoLimitPlus;
            YRAxisDown = WireParam_Global.YR_ServoLimitMinus;
            YRAxisUp = WireParam_Global.YR_ServoLimitPlus;
            FeedAdjustSpeed = WireParam_Global.FeedAdjustSpeed;
        }
        #region 事件
        private DelegateCommand _GoBackCommand;

        public DelegateCommand GoBackCommand =>
            _GoBackCommand ?? (_GoBackCommand = new DelegateCommand(ExecuteGoBackCommand));

        void ExecuteGoBackCommand()
        {
            _regionManager.RequestNavigate(PrismManager.MainViewRegionName, AppViews.ST04DeviceManagerView);
        }


        private DelegateCommand<string> _TextChangeCommand;
        public DelegateCommand<string> TextChangeCommand =>
            _TextChangeCommand ?? (_TextChangeCommand = new DelegateCommand<string>(ExecuteTextChangeCommand));

        void ExecuteTextChangeCommand(string p)
        {
            switch (p)
            {
                case "WireDia":
                    WireParam_Global.WireDia = WireDia;
                    break;
                case "WireLen_Set":
                    WireParam_Global.WireLen_Set = WireLen_Set;
                    break;
                case "YLeftBuChang":
                    WireParam_Global.YL偏心距补偿 = YLeftBuChang;
                    break;
                case "YRightBuChang":
                    WireParam_Global.YR偏心距补偿 = YRightBuChang;
                    break;
                case "XAxisBuChang":
                    WireParam_Global.X轴补偿 = XAxisBuChang;
                    break;
                case "QiaosiHeight":
                    WireParam_Global.桥丝距产品高度 = QiaosiHeight;
                    break;
                case "TensionLimitH":
                    WireParam_Global.TensionLimit_UP = TensionLimitH;
                    break;
                case "TensionLimitL":
                    WireParam_Global.TensionLimit_Down = TensionLimitL;
                    break;
                case "TurretDia":
                    WireParam_Global.TurretDia = TurretDia;
                    break;
                case "FeedDia":
                    WireParam_Global.FeedDia = FeedDia;
                    break;
                case "XAxisDown":
                    WireParam_Global.X_ServoLimitMinus = XAxisDown;
                    break;
                case "XAxisUp":
                    WireParam_Global.X_ServoLimitPlus = XAxisUp;
                    break;
                case "YLAxisDown":
                    WireParam_Global.YL_ServoLimitMinus = YLAxisDown;
                    break;
                case "YLAxisUp":
                    WireParam_Global.YL_ServoLimitPlus = YLAxisUp;
                    break;
                case "YRAxisDown":
                    WireParam_Global.YR_ServoLimitMinus = YRAxisDown;
                    break;
                case "YRAxisUp":
                    WireParam_Global.YR_ServoLimitPlus = YRAxisUp;
                    break;
                case "FeedAdjustSpeed":
                    WireParam_Global.FeedAdjustSpeed = FeedAdjustSpeed;
                    break;
                default:
                    break;
            }
        }

        #endregion


        #region 属性


        private float _WireDia;
        public float WireDia
        {
            get { return _WireDia; }
            set { SetProperty(ref _WireDia, value); }
        }

        private float _WireLen_Set;
        public float WireLen_Set
        {
            get { return _WireLen_Set; }
            set { SetProperty(ref _WireLen_Set, value); }
        }

        private float _YLeftBuChang;
        public float YLeftBuChang
        {
            get { return _YLeftBuChang; }
            set { SetProperty(ref _YLeftBuChang, value); }
        }

        private float _YRightBuChang;
        public float YRightBuChang
        {
            get { return _YRightBuChang; }
            set { SetProperty(ref _YRightBuChang, value); }
        }

        private float _XAxisBuChang;
        public float XAxisBuChang
        {
            get { return _XAxisBuChang; }
            set { SetProperty(ref _XAxisBuChang, value); }
        }

        private float _QiaosiHeight;
        public float QiaosiHeight
        {
            get { return _QiaosiHeight; }
            set { SetProperty(ref _QiaosiHeight, value); }
        }

        private float _TensionLimitH;
        public float TensionLimitH
        {
            get { return _TensionLimitH; }
            set { SetProperty(ref _TensionLimitH, value); }
        }

        private float _TensionLimitL;
        public float TensionLimitL
        {
            get { return _TensionLimitL; }
            set { SetProperty(ref _TensionLimitL, value); }
        }


        private float _TurretDia;
        public float TurretDia
        {
            get { return _TurretDia; }
            set { SetProperty(ref _TurretDia, value); }
        }

        private float _FeedDia;
        public float FeedDia
        {
            get { return _FeedDia; }
            set { SetProperty(ref _FeedDia, value); }
        }

        private float _XAxisDown;
        public float XAxisDown
        {
            get { return _XAxisDown; }
            set { SetProperty(ref _XAxisDown, value); }
        }

        private float _XAxisUp;
        public float XAxisUp
        {
            get { return _XAxisUp; }
            set { SetProperty(ref _XAxisUp, value); }
        }

        private float _YLAxisDown;
        public float YLAxisDown
        {
            get { return _YLAxisDown; }
            set { SetProperty(ref _YLAxisDown, value); }
        }


        private float _YLAxisUp;
        public float YLAxisUp
        {
            get { return _YLAxisUp; }
            set { SetProperty(ref _YLAxisUp, value); }
        }

        private float _YRAxisDown;
        public float YRAxisDown
        {
            get { return _YRAxisDown; }
            set { SetProperty(ref _YRAxisDown, value); }
        }


        private float _YRAxisUp;
        public float YRAxisUp
        {
            get { return _YRAxisUp; }
            set { SetProperty(ref _YRAxisUp, value); }
        }

        private float _FeedAdjustSpeed;
        public float FeedAdjustSpeed
        {
            get { return _FeedAdjustSpeed; }
            set { SetProperty(ref _FeedAdjustSpeed, value); }
        }
        #endregion
    }
}
